package com.util;

public class Page {
	private int currentPage;//当前页
    private int pageSize=5;//一页显示的记录数
    private int totalSize;//总记录数
    private int totalPage;//总页数
    private boolean hasFirst;//是否有首页
    private boolean hasPrevious;//是否有上一页
    private boolean hasNext; //是否有下一页
    private boolean hasLast;//是否有尾页
    public Page(){
    	
    }
    public Page(int currentPage,int totalSize){
    	this.currentPage=currentPage;
    	this.totalSize=totalSize;
    }
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalSize() {
		return totalSize;
	}
	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}
	//总页数
	public int getTotalPage() {
		if(getTotalSize()%getPageSize()==0){
			totalPage=getTotalSize()/getPageSize();
		}else{
			totalPage=getTotalSize()/getPageSize()+1;
		}
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	//是否有首页，如果当前是第一页，首页不显示
	public boolean isHasFirst() {
		if(currentPage==1){
			return false;
		}
		return true;
	}
	public void setHasFirst(boolean hasFirst) {
		this.hasFirst = hasFirst;
	}
	//是否有上一页，如果首页显示，可以上翻
	public boolean isHasPrevious() {
		if(isHasFirst()){
			return true;
		}
		return false;
	}
	public void setHasPrevious(boolean hasPrevious) {
		this.hasPrevious = hasPrevious;
	}
	//是否有下一页,如果尾页显示，可以下翻
	public boolean isHasNext() {
		if(isHasLast()){
			return true;
		}
		return false;
	}
	public void setHasNext(boolean hasNext) {
		this.hasNext = hasNext;
	}
	//是否有尾页，如果当前页等于总页数，尾页不显示
	public boolean isHasLast() {
		if(currentPage==getTotalPage()){
			return false;
		}
		return true;
	}
	public void setHasLast(boolean hasLast) {
		this.hasLast = hasLast;
	}
    
}
